import { createApiRequest as cri } from "@/utils";

async function createApiRequest(method, url, data) {
    return cri(method, url, data)
}

export function getChannelApi() {
    return createApiRequest('GET', 'channels');
}

export function publishApi(data) {
    return createApiRequest('POST', 'mp/articles?draft=false', data);
}

export function getArticlesApi(data) {
    return createApiRequest('GET', 'mp/articles', data)
}

export function deleteArticleApi(id) {
    return createApiRequest('DELETE', `mp/articles/${id}`);
}

export function getArticleSpecificApi(data) {
    return createApiRequest('GET', `mp/articles/${data}`)
}

export function updateArticleApi(data) {
    return createApiRequest('PUT', `mp/articles/${data.id}?draft=false`, data)
}